import { ElButton } from 'element-plus';
export default function() {
	const area = this.area({
		$slots: {
			header: {
				is: $Between,
				left: '用户信息',
				right: {
					is: ElButton,
					size: 'small',
					type: 'primary',
					children: '查看用户信息',
					onClick: async () => {
						const values = await action.value()
						alert(JSON.stringify(values));
					}
				}
			}
		}
	});

	const action = area.add(
		$Input({
			$name: 'name',
			$label: '姓名',
			$rules: ['required', [2, 4]]
		}),
		$Select({
			$name: 'sex',
			$label: '性别',
			$options: [
				{ text: '男', value: 1 },
				{ text: '女', value: 2 }
			],
			$rules: ['required']
		}),
		$InputNumber({
			$name: 'age',
			$label: '年龄',
			$rules: [val => {
				if (val < 18) return '您还是未成年！！';
			}]
		})
	).done();
}